import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    city: "北京"
  },
  getters: {
  },
  mutations: {
    changeCityValue(state, city) {//两个参数  state  传过来的参数
      state.city = city
      console.log(state.city);
    }
  },
  actions: {
    changeCity(ctx, city) {//两个参数  上下文  传过的参数
      // alert(city)
      ctx.commit("changeCityValue", city)
    }
  },
  modules: {
  },
  getters: {

  }
})
